## 使用python进行接口获取


import requests
import pandas as pd

url = 'https://api.hunhepan.com/v1/extab/list_all'  # 替换为你要访问的接口URL
response = requests.get(url)
data = ''

if response.status_code == 200:
    data = response.json()  # 如果接口返回的是JSON数据
    #print(data['data'])
else:
    print('Failed to retrieve data from the API')

# 将数据写入本地文件
with open("./file/012.爬取数据.txt", "w", encoding="utf-8") as f:
    f.write(str(data['data']))

# 使用pandas展示数据
df = pd.DataFrame(data['data'])

# 删除不要的列
df.drop(['key', 'item_order', 'show', 'edges'], axis=1, inplace=True)

# 保存到excel中
df.to_excel("./file/012.爬取数据.xlsx", index=False)

    
